#ifndef ERROR_H_
#define ERROR_H_

#include <exception>
#include <string>
#include <Python.h>

#define PYERR_MODULE(name)	"Failed to load module '" name "'"
#define PYERR_ATTR(name) 	"Failed to get attribute '" name "'"
#define PYERR_FUNC(name)	"Function '" name "' failed"

class GError: public std::exception
{
protected:
	std::string msg;
public:
	GError(std::string msg) throw () :
			msg(msg)
	{
	}
	~GError() throw ()
	{
	}
	virtual const char* what() const throw ()
	{
		return msg.c_str();
	}
};

class PythonError: public GError
{
public:
	PythonError(std::string err) throw ();
};

void pythonError(PyObject *obj, std::string msg);

#endif /* ERROR_H_ */
